#@layout()

#define script()
<script>
    $.ajax({
        url: "http://47.105.208.60:8080/wechat-api/category/findByTitle?title=季赛"
        //url: "http://localhost:8080/category/findByTitle?title=季赛"
        , dataType: 'json'
        , type: 'get'
        , success: function (data) {

            if (data.code == 0) {
                var infos = data.info;
                $(infos).each(function () {

                    var content = "<tr id='tr' class='tr'>"+
                        "<td>"+this.title+"</td>"+
                        "<td><textarea rows='2' cols='15'>" + this.content + "</textarea></td>"+
                        "<td><button onclick='update(\"" + this.id + "\")'>修改</button></td>"+
                        "</tr>";
                    $("#season").append($(content));
                })
            }
            else
            {
                alert("操作失败");//请求传输失败回调函数
            }
        }
        , error: function (msg) {
            console.log("----------")
            alert(msg); //错误信息

        }
    });

    $.ajax({
        url: "http://47.105.208.60:8080/wechat-api/category/findByTitle?title=主题赛"
        //url: "http://localhost:8080/category/findByTitle?title=主题赛"
        , dataType: 'json'
        , type: 'get'
        , success: function (data) {

            if (data.code == 0) {
                var infos = data.info;
                $(infos).each(function () {

                    var content = "<tr id='tr' class='tr'>"+
                        "<td>"+this.title+"</td>"+
                        "<td><textarea rows='2' cols='15'>" + this.content + "</textarea></td>"+
                        "<td><button onclick='update(\"" + this.id + "\")'>修改</button></td>"+/*<button onclick='del(\"" + this.id + "\")'>删除</button>*/
                        "</tr>";
                    $("#theme").append($(content));
                })
            }
            else
            {
                alert("操作失败");//请求传输失败回调函数
            }
        }
        , error: function (msg) {
            console.log("----------")
            alert(msg); //错误信息

        }
    });

    $.ajax({
        url: "http://47.105.208.60:8080/wechat-api/category/findByTitle?title=年赛"
        //url: "http://localhost:8080/category/findByTitle?title=年赛"
        , dataType: 'json'
        , type: 'get'
        , success: function (data) {

            if (data.code == 0) {
                var infos = data.info;
                $(infos).each(function () {

                    var content = "<tr id='tr' class='tr'>"+
                        "<td>"+this.title+"</td>"+
                        "<td><textarea rows='2' cols='15'>" + this.content + "</textarea></td>"+
                        "<td><button onclick='update(\"" + this.id + "\")'>修改</button></td>"+
                        "</tr>";
                    $("#year").append($(content));
                })
            }
            else
            {
                alert("操作失败");//请求传输失败回调函数
            }
        }
        , error: function (msg) {
            console.log("----------")
            alert(msg); //错误信息

        }
    });

    function update(id) {
        window.location.href = "#(CPATH)/admin/shoot/update?id=" + id;
    }

    function add() {
        window.location.href = "#(CPATH)/admin/shoot/add";
    }
</script>

#end

#define content()
<div class="content-wrapper">
    <section class="content-header">
        <h1>
            赛事管理
        </h1>
    </section>

    <section class="content-header text-tap">
    </section>
    <div>
        <div style="height: 450px">
            <div class="box box-primary" style="height: 400px;width: 600px;float: left;margin-right: 20px;">
                <section class="content-header">
                    <h1>
                        <h4>季赛</h4>
                    </h1>
                </section>
                <div class="box-body ">

                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th>赛事名称</th>
                            <th>赛事说明</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="season">
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="box box-primary" style="height: 400px;width: 600px;float: left;">
                <section class="content-header">
                    <h1>
                        <h4>主题赛</h4>
                    </h1>
                </section>
                <div class="box-body ">
                    <button onclick="add()">新建</button>
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th>赛事名称</th>
                            <th>赛事说明</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="theme">


                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="box box-primary" style="width: 1200px;height: 300px;padding-left: 10px">
            <section class="content-header">
                <h1>
                    <h4>年赛</h4>
                </h1>
            </section>
            <div class="box-body ">

                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>赛事名称</th>
                        <th>赛事说明</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="year">


                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
#end
